Add gcc config option for fanalyzer. As a result of this option, a static
analysis of the program flow is conducted, allowing interprocedural paths
to be identified and warnings to be issued if problems are identified.
Link: https://github.com/openwrt/openwrt/pull/12576
Signed-off-by: Nick Hainke <[email protected]>
comment "Hardening build options"
+ config PKG_FANALYZER
+ bool
+ prompt "Enable gcc fanalyzer"
+ default n
+ help
+ Add -fanalyzer to the CFLAGS. As a result of this option, a static analysis
+ of the program flow is conducted, allowing interprocedural paths to be
+ identified and warnings to be issued if problems are identified.
+
config PKG_CHECK_FORMAT_SECURITY
bool
prompt "Enable gcc format-security"
PKG_FORTIFY_SOURCE ?= 1
PKG_RELRO ?= 1
PKG_DT_RELR ?= 1
+PKG_FANALYZER ?= 0
ifdef CONFIG_PKG_CHECK_FORMAT_SECURITY
ifeq ($(strip $(PKG_CHECK_FORMAT_SECURITY)),1)
endif
endif
+ifdef CONFIG_PKG_FANALYZER
+ ifeq ($(strip $(PKG_FANALYZER)),1)
+ TARGET_CFLAGS += -fanalyzer
+ endif
+endif